<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: xwj32
  Date: 2023-05-08
  Time: 22:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <jsp:include page="include/mangerheadtag.jsp"/>
    <title>Document</title>
    <style>
        body{
            background-image: url("/images/background-img/leaves.png");
        }

        #container{
            border: 1px solid black;
        }
    </style>


</head>
<body>
<jsp:include page="include/head.jsp"/>
<jsp:include page="include/mangermenu.jsp"/>


<div style="margin-left: 300px;margin-top: 100px">
    <div class="container mt-3" id="container">
        <h2><img src="${pageContext.request.contextPath}/images/img/用户管理.png" alt="">
            医生信息管理</h2>
        <table class="table table-striped">
            <thead>
            <tr>
                <th>姓名</th>
                <th>性别</th>
                <th>年龄</th>
                <th>出诊费</th>
                <th>科室</th>
                <th>诊室</th>
                <th>专业能力</th>
                <th colspan="2">操作</th>
            </tr>
            </thead>

            <tbody>
            <c:forEach items="${requestScope.doctorList}" var="doctor">
                <tr>
                    <td>${doctor.dname}</td>
                    <td>${doctor.gender}</td>
                    <td>${doctor.age}</td>
                    <td>${doctor.fee}</td>
                    <td>${doctor.office}</td>
                    <td>${doctor.room}</td>
                    <td>${doctor.ability}</td>
                    <td><a class="deleteClass btn btn-success" href="<%=request.getContextPath()%>/DoctorManagementServlet?action=delete&did=${doctor.did}">删除</a></td>
                    <td><a class="btn btn-success" href="<%=request.getContextPath()%>/DoctorManagementServlet?action=getDoctor&did=${doctor.did}">修改</a></td>
                </tr>
            </c:forEach>
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td><a href=""></a></td>
                <td></td>
                <td></td>
                <td></td>
                <td><a class="btn btn-primary" href="<%=request.getContextPath()%>/manager/addDoctor.jsp">增加</a></td>
            </tr>
            <style>
                .button {
                    display: inline-block;
                    padding: 0.5em 1em;
                    background-color: #ccc;
                    color: #fff;
                    text-align: center;
                    text-decoration: none;
                    border-radius: 0.5em;
                }
            </style>
            </tbody>
        </table>

    </div>
</div>
<script type="text/javascript">
    //confirm是确认提示框函数
    //返回true表示点击确认
    $(function (){
        $("a.deleteClass").click(function (){
            return  confirm("你确定要删除【"+$(this).parent().parent().find("td:first").text()+"医生吗"+"】");
        })
    });
</script>
</body>
</html>
